﻿using System;
using System.ComponentModel.DataAnnotations;
using ServiceStack.DataAnnotations;

namespace NetSurveillance.WebApp.DataServices.Models
{
    [Alias("MultiSearch")]
    public class MultiSearch : BaseModel
    {
        [AutoIncrement]
        public long Id { get; set; }

        [Required]
        [StringLength(20)]
        public string Subject { get; set; }

        [DataType(DataType.DateTime)]
        public DateTime? StartDate { get; set; }

        [DataType(DataType.DateTime)]
        public DateTime? EndDate { get; set; }

        [StringLength(32)]
        public string Protocol { get; set; }

        [References(typeof(User))]
        public long CreatedUserId { get; set; }

        [References(typeof(Task))]
        public long TaskId { get; set; }

        [StringLength(20)]
        public string Account { get; set; }

        [StringLength(200)]
        [DataType(DataType.Password)]
        public string Password { get; set; }

        [StringLength(32)]
        [RegularExpression(@"^(\d{1,2}|1\d\d|2[0-3]\d|22[0-3])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$", ErrorMessage = "IP格式不正确")]
        public string IP { get; set; }

        [StringLength(32)]
        public string Mac { get; set; }

        [StringLength(32)]
        [RegularExpression(@"^(\d{1,2}|1\d\d|2[0-3]\d|22[0-3])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$", ErrorMessage = "远程IP格式不正确")]
        public string RemoteIP { get; set; }

        [StringLength(32)]
        public string RemoteMac { get; set; }

        [StringLength(64)]
        [DataType(DataType.EmailAddress)]
        public string EmailFrom { get; set; }

        [StringLength(64)]
        [DataType(DataType.EmailAddress)]
        public string EmailTo { get; set; }

        [StringLength(64)]
        public string EmailCC { get; set; }

        [DataType(DataType.DateTime)]
        public DateTime? EmailDate { get; set; }

        [StringLength(64)]
        public string SystemInfo { get; set; }

        [StringLength(64)]
        public string ClientVer { get; set; }

        [StringLength(32)]
        public string FileType { get; set; }

        [StringLength(200)]
        public string Url { get; set; }

        [Ignore]
        public User CreatedUser { get; set; }

    }
}
